﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using MySql.Data;
using MySql.Data.MySqlClient;
using OnlineGame.src.Others;

namespace OnlineGame
{
    class Characters
    {
       SpriteFont LetterScreen;
       SpriteFont createCharFont;
       Vector2 fontLocation;

       Texture2D bgScreenCharacter;
       Rectangle positionCharacter;
       Rectangle soucerCharacter;

       Rectangle positionCreateCharacter;
       Texture2D createCharacter;
       Rectangle sourceCreateCharacter;

        public Characters(ContentManager Content, GameWindow Window)
        {
            LetterScreen = (Content.Load<SpriteFont>("Arial40"));
            bgScreenCharacter =(Content.Load<Texture2D>("BG"));
            createCharacter = (Content.Load<Texture2D>("BG"));
            createCharFont = (Content.Load<SpriteFont>("Arial40"));

            positionCharacter = new Rectangle(50, 75, 260, 320);
            soucerCharacter = new Rectangle(300, 0, 260, 320);

            positionCreateCharacter = new Rectangle(450, 75, 260, 100);
            sourceCreateCharacter = new Rectangle(0, 0, 260, 100);

            fontLocation = new Vector2(positionCreateCharacter.X, positionCreateCharacter.Y);

        }
        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            spriteBatch.DrawString(LetterScreen, "CHOOSE YOUR CHARACTER", Vector2.Zero, Color.Black);
            spriteBatch.DrawString(LetterScreen, "Create Char", fontLocation, Color.Black);

            spriteBatch.Draw(bgScreenCharacter,positionCharacter , soucerCharacter, Color.LightBlue);
            spriteBatch.Draw(createCharacter, positionCreateCharacter, sourceCreateCharacter, Color.LightBlue);
            

        }
        public void Update(GameTime gameTime, SpriteBatch spriteBatch,Rectangle mousePos)
        {
            if (mousePos.Intersects(positionCharacter))
            {
                soucerCharacter.X = 600;
                soucerCharacter.Y = 0;
            }
            else
            {
                soucerCharacter.X = 300;
                soucerCharacter.Y = 0;
            }

            if (mousePos.Intersects(positionCreateCharacter) && Mouse.GetState().LeftButton == ButtonState.Pressed)
            {
                sourceCreateCharacter.X = 600;
                sourceCreateCharacter.Y = 0;
                Game1.currentState = Game1.gameStates.CREATECHARACTERS;
            }
            else
            {
                sourceCreateCharacter.X = 0;
                sourceCreateCharacter.Y = 0;
            }
        }

    }
}
